<template>
  <div class="contain">
    <div class="header">
      <div class="header-box">
        <div class="header-l">
          <van-icon name="arrow-left" />
          <span @click="backTo">返回</span>
        </div>

        <h2 class="header-m">品牌制造商</h2>
        <div></div>
      </div>
    </div>
    <van-list
      v-model="loading"
      :finished="finished"
      finished-text="没有更多了"
      @load="onLoad"
    >
      <div>
        <div v-for="item in list" :key="item.id" class="newGoods">
          <ul class="newGoodsBox">
            <li
              v-for="el in item"
              :key="el.id"
              class="newGoods-item"
              @click="toList(el.id)"
            >
              <img class="img" :src="el.app_list_pic_url" alt="" />
              <div class="new-txt">
                <div class="newGoods-name">
                  <span>{{ el.name }}|{{ el.floor_price }}起</span>
                </div>
              </div>
            </li>
          </ul>
        </div>
      </div>
    </van-list>
  </div>
</template>
  
  <script>
import { listaction } from "@/api/home";

export default {
  name: "brand",
  data() {
    return {
      list: [],
      page: 1,
      loading: false,
      finished: false,
    };
  },
  mounted() {},
  methods: {
    onLoad() {
      // 异步更新数据

      listaction({
        page: this.page,
      }).then((res) => {
        console.log(res);
        this.list.push(res.data);

        this.loading = false;
        this.page++;
        console.log(this.list);

        // 数据全部加载完成
        if (this.page > res.total) {
          this.finished = true;
        }
      }, 1000);

      // 加载状态结束
    },
    toList(id) {
      console.log("12");
      this.$router.push({ path: "/home/brandList", query: { id: id } });
    },
    backTo(){
      this.$router.back()
    }
  },
};
</script>
  
  
  <style scoped lang="scss" >
@import "./scss/index.scss";
</style>>
  
  